<?php

use yii\db\Migration;

/**
 * Handles the creation of table `sys_menu`.
 */
class m190124_094204_create_sys_menu_table extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $this->createTable('sys_menu', [
            'id' => $this->primaryKey(),
            'pid' => $this->integer()->notNull()->defaultValue(0)->comment('父id'),
            'cate_id' => $this->integer()->notNull()->defaultValue(1)->comment('分类id'),
            'name' => $this->string(32)->notNull()->defaultValue('')->comment('分类名称'),
            'url' => $this->string(64)->defaultValue('')->comment('链接url'),
            'icon' => $this->string(32)->defaultValue('')->comment('连接icon'),
            'sort' => $this->tinyInteger(4)->defaultValue(1)->comment('排序'),
            'level' => $this->tinyInteger(4)->defaultValue(1)->comment('菜单级别'),
            'status' => $this->tinyInteger(4)->defaultValue(1)->comment('菜单状态[-1:删除,0:禁用,1:启用]'),
            'created_at' => $this->integer()->notNull()->comment('添加时间'),
            'updated_at' => $this->integer()->notNull()->comment('更新时间')
        ]);
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $this->dropTable('sys_menu');
    }
}
